/*
 * Copyright (c) 2009 Sylvestre Gallon <syl@pmbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#import <Foundation/NSObject.h>
#import <GL/gl.h>
#import <stdlib.h>
#import "md2format.h"
#import "logger.h"


@interface md2loader: NSObject {
/* MD2 */
	uint32_t ident;
	uint32_t version;

	uint32_t skinwidth;
	uint32_t skinheight;

	uint32_t  framesize;

	uint32_t num_skins;
	uint32_t num_vertices;
	uint32_t num_st;
	uint32_t num_trus;
	uint32_t num_glcmds;
	uint32_t num_frames;

	uint32_t offset_skins;
	uint32_t offset_st;
	uint32_t offset_tris;
	uint32_t offset_frames;
	uint32_t offset_glcmds;
	uint32_t offset_end;
/* Internal */
	FILE *fd;
	GLfloat scale;
	GLuint texid;
	uint32_t *glcmds;	
}

- (uint32_t) ident;
- (uint32_t) version;
- (uint32_t) skinwidth;
- (uint32_t) skinheight;
- (uint32_t) framesize;
- (uint32_t) num_skins;
- (uint32_t) num_vertices;
- (uint32_t) num_st;
- (uint32_t) num_trus;
- (uint32_t) num_glcmds;
- (uint32_t) num_frames;
- (uint32_t) offset_skins;
- (uint32_t) offset_st;
- (uint32_t) offset_tris;
- (uint32_t) offset_frames;
- (uint32_t) offset_glcmds;
- (uint32_t) offset_end;

- (id) initWithFileName: (const char *) name;
- (void) dump_info;
- (void) loadmodel;
- (void) loadtexture;
- (void) renderframe;
- (void) setscale: (GLfloat) scale;
- (GLfloat) scale;

@end
